package com.etc.service.impl;

import java.util.List;

import com.etc.dao.impl.AnnouncementDaoImpl;
import com.etc.dao.BaseDao;

import com.etc.dao.AnnouncementDao;
import com.etc.entity.Announcement;
import com.etc.service1.AnnouncementService;

public class AnnouncementServiceImpl extends BaseDao implements AnnouncementService {

	
	AnnouncementDao announcementdao = new AnnouncementDaoImpl();
	@Override
	public List<Announcement> listAnnouncement() {
		return announcementdao.listAnnouncement();
		
	}

	@Override
	public boolean addAnnouncement(Announcement announcement) {
		int a = announcementdao.addAnnouncement(announcement);
		if(a>0) {
			System.out.println("添加成功!");
		return true;
	
	}else {
		System.out.println("添加失败!");
		return false;
		}
	}

	@Override
	public boolean deleteAnnouncement(long id) {
		int a = announcementdao.deleteAnnouncement(id);
		if(a>0) {
			System.out.println("删除成功!");
		return true;
	
	}else {
		System.out.println("删除失败!");
		return false;
		}
	}

	@Override
	public Announcement loadannouncement(long id) {
		// TODO Auto-generated method stub
				return announcementdao.loadannouncement(id);
}
	
	@Override
	public Long countAll() {
		// TODO Auto-generated method stub
		return announcementdao.countAll();
	}

	@Override
	public boolean modifyAnnouncement(Announcement announcement) {
		int a = announcementdao.modifyAnnouncement(announcement);
		if(a>0) {
			System.out.println("修改成功!");
		return true;
	
	}else {
		System.out.println("修改失败!");
		return false;
		}
	}
}